<template>
	<view class="settle-container">
    <!-- 全选按钮 -->
      <label class="radio" @click="changeAllState">
        <radio color="#C00000" :checked="isFullCheck" /><text>全选</text>
      </label>
      <!-- 合计区域 -->
      <view class="amount-box">
        合计:<text>￥{{checkedGoodsAmount}}</text>
      </view>
      <!-- 结算区域 -->
      <view class="btn-settle">结算({{checkedCount}})</view>
	</view>
</template>

<script>
  // 把m_cart模块的getters映射到当前页面进行使用
  import { mapGetters, mapMutations } from 'vuex'
	export default {
		data() {
			return {
				
			};
		},
    computed: {
      // 将m_cart模块的统计已经勾选的商品总数量checkedCount方法映射到当前页面进行使用
      ...mapGetters('m_cart', ['checkedCount', 'total', 'checkedGoodsAmount']),
      isFullCheck () {
        return this.total === this.checkedCount
      }
    },
    methods: {
      ...mapMutations('m_cart', ['updateAllGoodsState']),
      changeAllState () {
        this.updateAllGoodsState(!this.isFullCheck)
      }
    }
	}
</script>

<style lang="scss">
.settle-container{
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 50px;
  background-color: white;
  .radio{
    display: flex;
    align-items: center;
  }
  .amount-box{
    color: #C00000;
    font-weight: 700;
  }
  .btn-settle{
    background-color: #C00000;
    height: 50px;
    line-height: 50px;
    padding: 0 10px;
    min-width: 100px;
    text-align: center;
    color: white;
  }
}
</style>
